const compressing = require("compressing");
const fs = require("fs-extra");
const nodeFs = require("fs");
module.exports.pack = filePath => to =>
  compressing.zip.compressDir(filePath, to,{ignoreBase:true});
module.exports.unpack = file => to => compressing.zip.uncompress(file, to);
module.exports.removePath = fs.remove;
module.exports.moveFile = file => to => fs.move(file, to);
module.exports.createPath = path => fs.ensureDir(path, 0o2777);
module.exports.copy = path => to => fs.copy(path, to);
module.exports.rename = old => newName => fs.rename(old, newName)
module.exports.readFile = filePath =>
  Promise.resolve(nodeFs.readFileSync(filePath, { encoding: "utf-8" }));
module.exports.writeFile = filePath => content => {
  let file = nodeFs.openSync(filePath, "w");
  nodeFs.writeSync(file, content, 0, "utf-8");
  nodeFs.closeSync(file);
  return Promise.resolve(content);
};
